﻿$(function () {

    var linkhref = window.location.pathname;
    $('#ul_top li a').each(function () {        
        if ($(this).attr('href') == linkhref) {
            $(this).parents("li").parent("ul").children("li").removeClass("cur");
            $(this).parent('li').addClass("cur");
        }
    })

   


})
var getUrlParam = function (name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]); return null;
};
function CheckInputNullAll(demo) {
    var pattern = /(13\d|14[57]|15[^4,\D]|17[678]|18\d)\d{8}|170[059]\d{7}/;
    var card = /^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i;
    var flag = true;
    var inp = $("#" + demo + "").find("input[type='text'],input[type='number']");
    $(inp).each(function (m, n) {
        if ($(n).hasClass("required") == true && $(n).val() != "") {
            if ($(n).hasClass("tel")) {
                if (!pattern.test($(n).val())) {
                    layer.msg($(n).attr("placeholder"), { icon: 5 });
                    flag = false;
                    return flag;
                }
            }
            if ($(n).hasClass("sfz")) {
                if (!card.test($(n).val())) {
                    layer.msg($(n).attr("placeholder"), { icon: 5 });
                    flag = false;
                    return flag;
                }
            }
        } else if ($(n).hasClass("required") == true && $(n).val() == "") {
            layer.msg($(n).attr("placeholder"), { icon: 5 });
            flag = false;
            return flag;

        } else {
            return flag;
        }


    })
    return flag;

}